//导入koa
const Koa = require('koa')
//创建koa服务器
const app = new Koa()
//导入cors跨域
const cors = require('koa-cors')
//导入获取post数据
const {
    koaBody
} = require('koa-body')
// //导入路由模块
const router = require('./router/index.js')
  
app.use(koaBody())
app.use(cors())
app.use(router)
 
//开始处理请求
router.get('/', ctx => {
    ctx.body('/请求')
})
app.listen(12345, () => {
    console.log('server is runing at http://localhost:12345')
})